package com.hllxd.hism.star.basic.service.model.store;

import com.alibaba.fastjson.JSON;
import com.hllxd.hism.star.basic.service.model.EmpInfoEntity;
import com.hllxd.hism.star.basic.service.model.order.OrderDeliverEntity;
import lombok.Data;

import java.util.List;

/**
 * @author wanghuijie
 * @date 2020-11-18 7:53 下午
 */
@Data
public class AddOutStoreProductRequest {
    //合同ID
    private Long transOrderID;
    //出库方式
    private Integer outType = 3;
    //收货人姓名
    private String userName;
    //收货人手机号
    private String mobile ;
    //省份ID
    private Integer provinceId ;
    private String provinceName ;
    //城市
    private Integer cityId ;
    private String cityName ;
    //区域
    private Integer areaId;
    private String areaName;
    //收货人详细地址
    private String addressDetail;
    //出库商品列表
    List<OutProduct> outProduct;


    //出库批次号
    public String transOrderOutStoreBatchNo ;
    public EmpInfoEntity userInfo;

    public String accessToken;

    public static AddOutStoreProductRequest build(OrderDeliverEntity o) {
        AddOutStoreProductRequest thiz = new AddOutStoreProductRequest();
        thiz.transOrderID = o.transOrderID;
        thiz.outType = o.outType;
        thiz.userName = o.receiverName;
        thiz.mobile = o.receiverMobile;
        thiz.provinceId = o.provinceId;
        thiz.provinceName = o.provinceName;
        thiz.cityId = o.cityId;
        thiz.cityName = o.cityName;
        thiz.areaId = o.areaId;
        thiz.areaName = o.areaName;

        thiz.addressDetail = o.addressDetail;
        thiz.outProduct = JSON.parseArray(o.productDetailList,OutProduct.class);

        return thiz;
    }
}
